package com.Poker.Group;

import com.Poker.Poker;

import java.util.List;

/**
 * Created by mike on 18/5/23.
 */
public class SerialNumberGroupFilter extends BaseGroupFilter{
    public SerialNumberGroupFilter(List<Poker> pokers) {
        super(pokers);
    }

    @Override
    protected boolean filterHandler() {
        int flag = 0;
        int preNum = 0;
        for(Poker poker:pokers){
            if(flag==0){
                preNum = poker.getNum();
            }else{
                if(poker.getNum()-1!=preNum){
                    return false;
                }
                preNum = poker.getNum();
            }
            flag++;
        }
        return true;
    }
}
